<h1>Dashboard</h1>

<h2>Disk Useage</h2>
<?php
	$lines = explode("\n", trim(shell_exec("du -h {$_SERVER['DOCUMENT_ROOT']}")));
	echo substr($lines[count($lines)-1], 0, strpos($lines[count($lines)-1], "\t")) . 'B';
?>

<h2>Database Size</h2>
<?php
	$kb = 0;
	
	$sql = "SELECT table_schema '" . MYSQL_DATABASE . "', sum( data_length + index_length ) / 1024 'kilobytes' FROM information_schema.TABLES GROUP BY table_schema";
	$qry = db_query($sql);
	while ($table = db_fetch_assoc($qry)) {
		$kb+= $table['kilobytes'];
	}
	
	echo "{$kb}KB";	